<?php

/**
 * @author quangthinh
 * @copyright 2012
 */

class Qtadmin_Model_Category extends Zend_Db_Table_Abstract{
    public $_name = 'tbl_category';
    public $_primary = 'category_id';
    public $_sequence = true;
    
    /*============================== Su dung chung ===============================*/
   /**
     * Lay tat ca
     */
    public function getAll()
    {
        $se = $this->select();
        $se->where('active = ?', 1);
        $result = $this->fetchAll($se);
        if($result)
            return $result->toArray();
        return false;
    }
    
    /**
     * Lay tat ca thoa dieu kien
     */
    public function getWhere($where, $val)
    {
        $se = $this->select();
        $se->where($where, $val);
        $result = $this->fetchAll($se);
        if($result)
            return $result->toArray();
        return false;
    }
    
    /**
     * Lay 1 thoa dieu kien
     */
    public function getWhereOne($where, $val)
    {
        $se = $this->select();
        $se->where($where, $val);
        $result = $this->fetchAll($se);
        if($result)
            return $result->toArray();
        return false;
    }
    /*==============================End Su dung chung ===============================*/
}

